var MaJiang = new Object();

// 牌值转图片
MaJiang.cardPng = function (cardNum){
    // 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,						//同子
    // 0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,						//万子
    // 0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,						//索子
    // 0x31,0x32,0x33,0x34,0x35,0x36,0x37,						            //东南西北中发白
    var cardPng = {0x01:"card_11", 0x02:"card_12", 0x03:"card_13", 0x04:"card_14", 0x05:"card_15", 0x06:"card_16", 0x07:"card_17", 0x08:"card_18", 0x09:"card_19",
                   0x11:"card_21", 0x12:"card_22", 0x13:"card_23", 0x14:"card_24", 0x15:"card_25", 0x16:"card_26", 0x17:"card_27", 0x18:"card_28", 0x19:"card_29",
                   0x21:"card_31", 0x22:"card_32", 0x23:"card_33", 0x24:"card_34", 0x25:"card_35", 0x26:"card_36", 0x27:"card_37", 0x28:"card_38", 0x29:"card_39",
                   0x31:"card_41", 0x32:"card_42", 0x33:"card_43", 0x34:"card_44", 0x35:"card_45", 0x36:"card_46", 0x37:"card_47"};

    // var cardPngNum = {1:0x01, 2:0x02, 3:0x03, 4:0x04, 5:0x05, 6:0x06, 7:0x07, 8:0x08, 9:0x09,
    //                10:0x11, 11:0x12, 12:0x13, 13:0x14, 14:0x15, 15:0x16, 16:0x17, 17:0x18, 18:0x19,
    //                19:0x21, 20:0x22, 21:0x23, 22:0x24, 23:0x25, 24:0x26, 25:0x27, 26:0x28, 27:0x29,
    //                28:0x31, 29:0x32, 30:0x33, 31:0x34, 32:0x35, 33:0x36, 34:0x37};

    // var cardNum = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9,
    //                10:17, 11:18, 12:19, 13:20, 14:21, 15:22, 16:23, 17:24, 18:25,
    //                19:33, 20:34, 21:35, 22:36, 23:37, 24:38, 25:39, 26:40, 27:41,
    //                28:49, 29:50, 30:51, 31:52, 32:53, 33:54, 34:55};

    // var cardNum = {0x01:1, 0x02:2, 0x03:3, 0x04:4, 0x05:5, 0x06:6, 0x07:7, 0x08:8, 0x09:9,
    //                0x11:17, 0x12:18, 0x13:19, 0x14:20, 0x15:21, 0x16:22, 0x17:23, 0x18:24, 0x19:25,
    //                0x21:33, 0x22:34, 0x23:35, 0x24:36, 0x25:37, 0x26:38, 0x27:39, 0x28:40, 0x29:41,
    //                0x31:49, 0x32:50, 0x33:51, 0x34:52, 0x35:53, 0x36:54, 0x37:55};

    // var cardPng = {"1":"card_11", "2":"card_12", "3":"card_13", "4":"card_14", "5":"card_15", "6":"card_16", "7":"card_17", "8":"card_18", "9":"card_19",
    //                "17":"card_21", "18":"card_22", "19":"card_23", "20":"card_24", "21":"card_25", "22":"card_26", "23":"card_27", "24":"card_28", "25":"card_29",
    //                "33":"card_31", "34":"card_32", "35":"card_33", "36":"card_34", "37":"card_35", "38":"card_36", "39":"card_37", "40":"card_38", "41":"card_39",
    //                "49":"card_41", "50":"card_42", "51":"card_43", "52":"card_44", "53":"card_45", "54":"card_46", "55":"card_47"};

    return cardPng[cardNum];
};

// 排序
MaJiang.cardList = function (arr){
    // 简化一下：a-b输出从小到大排序，b-a输出从大到小排序。
    // var arrSimple2=new Array(1,8,7,6);
    // arrSimple2.sort(function(a,b){return b-a});
    arr.sort(function(a,b){return b-a});
};



module.exports = MaJiang;